﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class my_help_edit : AdminpageBase
{    
  
    protected string ctype = null;
    protected long long_eid = 0;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            inidata();      
        }
    }
    private void inidata()
    {
        string eid = "";
        ctype = ReadRequest.RequestString("t");
        eid = ReadRequest.RequestString("eid");       
       
        try
        {
            if (long_eid > 15)
            {
                txtTitle.ReadOnly=true;
            }
            if (ctype != null && ctype.Length > 3 && "edit".Equals(ctype))
            {
                Model.SF_help_cont model;
                long_eid = long.Parse(eid);
                model = BLL.SF_help_cont.GetModel(long_eid);
                if (model != null)
                {                    
                    texteid.Text = long_eid.ToString();
                    txtTitle.Text = model.help_title;
                    txtContent.Value = model.help_content;
                }
            }
            else
            {
                ctype = "ad";
            }
        }
        catch {
            ctype = "ad";
        }       
        if (long_eid < 1)
        {
            ctype = "ad";
        }
    }
    //提交按钮事件
    protected void btn_submit_Click(object sender, EventArgs e)
    {
        Model.SF_help_cont m = BLL.SF_help_cont.GetModel(long.Parse(texteid.Text));
        if (m != null)
        {
             m.help_title=txtTitle.Text;
             m.help_content = txtContent.Value;
             if (BLL.SF_help_cont.Update(m) > 0)
             {
                 Response.Write("<script type=\"text/javascript\">alert('保存成功！');window.location.href = '/manage/right.aspx';</script>");
                 return;
             }
        }
        Page.RegisterStartupScript("back", "<script   languge='javascript'>alert('您的操作错误哦！');</script>");
    }
}